package com.dql.spring.config;

import com.dql.spring.bean.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Component;

/**
 * @Author: DQL
 * @Date: 2022/4/28 10:25
 */
@Component
/*@ComponentScan(value = "com.dql.spring", excludeFilters = {
        @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class, Repository.class})
})*/
@ComponentScan(value = "com.dql.spring", includeFilters = {
        /*@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class, Repository.class}),
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = BookService.class),*/
        @ComponentScan.Filter(type = FilterType.CUSTOM, classes = MyFilter.class)
},useDefaultFilters = false)

// FilterType.ANNOTATION 按照注解
// FilterType.ASSIGNABLE_TYPE 按照给定的类型
// FilterType.CUSTOM 自定义规则
public class MainConfig {

    @Bean
    public Person person(){
        return new Person("Lisi", 18);
    }
}
